using System.Collections.ObjectModel;
using System.Windows.Input;
using PinFun.Wpf;
using PinFun.Wpf.Controls;

namespace CodeLines
{
    public class MainWindowModel : ViewModelBase
    {
        public MainWindowModel()
        {
            CanClick = true;
            Ext = "*.cs|*.java|*.js|*.vue";
            Info = I18N("准备就绪");
            PageCount = 60;
            LineCount = 50;
            Ignore = "obj|bin|node_modules|dist";
            IgnoreCodes = @"//*
*品杰*
[assembly:*
#*
/**
**
**/";
            RemoveDirCommand = new RelayCommand<string>(RemoveDir);
        }

        private void RemoveDir(string dir)
        {
            if (Dirs.Contains(dir)) Dirs.Remove(dir);
        }

        public ObservableCollection<string> Dirs { get; } = new ObservableCollection<string>();

        public string Ext
        {
            get => GetValue(() => Ext);
            set => SetValue(() => Ext, value);
        }

        public string Ignore
        {
            get => GetValue(() => Ignore);
            set => SetValue(() => Ignore, value);
        }

        public int ActiveTabIndex
        {
            get => GetValue(() => ActiveTabIndex);
            set => SetValue(() => ActiveTabIndex, value);
        }

        public string IgnoreCodes
        {
            get => GetValue(() => IgnoreCodes);
            set => SetValue(() => IgnoreCodes, value);
        }

        public bool CanClick
        {
            get => GetValue(() => CanClick);
            set => SetValue(() => CanClick, value);
        }

        public int PageCount
        {
            get => GetValue(() => PageCount);
            set => SetValue(() => PageCount, value);
        }

        public int LineCount
        {
            get => GetValue(() => LineCount);
            set => SetValue(() => LineCount, value);
        }

        public string Info
        {
            get => GetValue(() => Info);
            set => SetValue(() => Info, value);
        }

        public string CodeSummary
        {
            get => GetValue(() => CodeSummary);
            set => SetValue(() => CodeSummary, value);
        }

        public ObservableCollection<CodeFile> Files { get; } = new ObservableCollection<CodeFile>();

        public ICommand RemoveDirCommand { get; }
    }
}
